// 用户画像相关类型
export interface UserProfile {
  id: string;
  role: TechRole;
  techPreferences: TechPreference[];
  experienceLevel: ExperienceLevel;
  attendancePurpose: AttendancePurpose[];
  timePreferences: TimePreference[];
  createdAt: Date;
  updatedAt: Date;
}

export type TechRole = 
  | 'developer' 
  | 'architect' 
  | 'product_manager' 
  | 'designer' 
  | 'business_analyst' 
  | 'student' 
  | 'other';

export type TechPreference = 
  | 'ai_ml' 
  | 'cloud_computing' 
  | 'big_data' 
  | 'iot' 
  | 'security' 
  | 'devops' 
  | 'frontend' 
  | 'backend' 
  | 'mobile' 
  | 'blockchain' 
  | 'databases' 
  | 'microservices';

export type ExperienceLevel = 'beginner' | 'intermediate' | 'advanced' | 'expert';

export type AttendancePurpose = 
  | 'learning' 
  | 'networking' 
  | 'business' 
  | 'recruitment' 
  | 'product_research' 
  | 'technology_evaluation';

export type TimePreference = 'morning' | 'afternoon' | 'full_day';

// 问卷相关类型
export interface Question {
  id: string;
  title: string;
  description?: string;
  type: QuestionType;
  options?: QuestionOption[];
  required: boolean;
  weight: number;
}

export type QuestionType = 'single_choice' | 'multiple_choice' | 'text' | 'rating';

export interface QuestionOption {
  id: string;
  label: string;
  value: string;
  description?: string;
}

export interface Answer {
  questionId: string;
  value: string | string[];
}

// 会议日程相关类型
export interface AgendaItem {
  id: string;
  title: string;
  description: string;
  startTime: Date;
  endTime: Date;
  location: string;
  speakers: Speaker[];
  tags: TechPreference[];
  level: ExperienceLevel;
  category: SessionCategory;
  maxAttendees?: number;
  currentAttendees?: number;
  rating?: number;
  isKeynote?: boolean;
}

export type SessionCategory = 
  | 'keynote' 
  | 'technical_session' 
  | 'workshop' 
  | 'panel_discussion' 
  | 'demo' 
  | 'networking' 
  | 'break';

export interface Speaker {
  id: string;
  name: string;
  title: string;
  company: string;
  bio: string;
  avatar?: string;
  socialLinks?: SocialLink[];
}

export interface SocialLink {
  platform: 'linkedin' | 'twitter' | 'github' | 'website';
  url: string;
}

// 推荐相关类型
export interface Recommendation {
  agendaItem: AgendaItem;
  score: number;
  reasons: RecommendationReason[];
  confidence: number;
}

export interface RecommendationReason {
  type: ReasonType;
  description: string;
  weight: number;
}

export type ReasonType = 
  | 'tech_match' 
  | 'level_match' 
  | 'time_preference' 
  | 'popularity' 
  | 'speaker_quality' 
  | 'topic_relevance';

// 用户日程相关类型
export interface UserSchedule {
  id: string;
  userId: string;
  items: ScheduleItem[];
  createdAt: Date;
  updatedAt: Date;
}

export interface ScheduleItem {
  id: string;
  agendaItem: AgendaItem;
  priority: Priority;
  notes?: string;
  reminders?: Reminder[];
}

export type Priority = 'high' | 'medium' | 'low';

export interface Reminder {
  id: string;
  time: Date;
  message: string;
  type: 'notification' | 'email';
}

// 冲突检测类型
export interface Conflict {
  id: string;
  type: ConflictType;
  items: ScheduleItem[];
  severity: ConflictSeverity;
  suggestions: ConflictSuggestion[];
}

export type ConflictType = 'time_overlap' | 'location_distance' | 'no_break_time';

export type ConflictSeverity = 'low' | 'medium' | 'high' | 'critical';

export interface ConflictSuggestion {
  type: 'remove_item' | 'replace_item' | 'adjust_time';
  description: string;
  alternativeItems?: AgendaItem[];
}

// UI状态相关类型
export interface AppState {
  currentStep: AppStep;
  userProfile?: UserProfile;
  recommendations: Recommendation[];
  userSchedule?: UserSchedule;
  conflicts: Conflict[];
  loading: boolean;
  error?: string;
}

export type AppStep = 'welcome' | 'profile' | 'recommendations' | 'schedule' | 'export';

// 筛选和排序类型
export interface FilterOptions {
  tags?: TechPreference[];
  levels?: ExperienceLevel[];
  categories?: SessionCategory[];
  timeRange?: {
    start: Date;
    end: Date;
  };
  speakers?: string[];
  location?: string;
  hasAvailableSeats?: boolean;
}

export interface SortOptions {
  field: SortField;
  direction: 'asc' | 'desc';
}

export type SortField = 'startTime' | 'title' | 'rating' | 'relevanceScore' | 'popularity';

// API响应类型
export interface ApiResponse<T> {
  success: boolean;
  data?: T;
  error?: string;
  message?: string;
}

export interface PaginatedResponse<T> extends ApiResponse<T[]> {
  pagination: {
    page: number;
    limit: number;
    total: number;
    totalPages: number;
  };
}

// 导出相关类型
export interface ExportOptions {
  format: ExportFormat;
  includeDescription: boolean;
  includeLocation: boolean;
  includeSpeakers: boolean;
  timeZone: string;
}

export type ExportFormat = 'ics' | 'pdf' | 'json' | 'csv';

// 通知相关类型
export interface Notification {
  id: string;
  type: NotificationType;
  title: string;
  message: string;
  timestamp: Date;
  read: boolean;
  actionUrl?: string;
}

export type NotificationType = 'info' | 'success' | 'warning' | 'error';